#pragma once
#ifndef PARSERGENERATOR_H
#define PARSERGENERATOR_H

#include "headers.h"

class ParserGenerator
{
public:
    ParserGenerator(const Grammar*);
    ~ParserGenerator();
    QList<int> GetStates();
    QStringList GetTerminalsAlphabet();
    QStringList GetNonterminalsAlphabet();
    const ControlTable* GetActionTable();
    const ControlTable* GetGotoTable();
    const QStringList* GetErrorsList();
    void SaveControlTables(QString);

private:
    /** fields **/
    const Grammar* grammar;
    QList<Set> sets;
    ControlTable* actionTable;
    ControlTable* gotoTable;
    QStringList errors;
    /** methods **/
    void generateSets();
    void recursive(Set*, QString);
    void generateSubSet(const Set*);
    void GenerateParserTables();
};

#endif // PARSERGENERATOR_H
